﻿using System;
using System.Collections.Generic;
using System.IO;

namespace SimpleFS.Services.Journaling.Implementations
{
    public class PlainTextJournalingServiceProvider : IJournalingServiceProvider, IDisposable
    {
        protected StreamWriter writer;

        public PlainTextJournalingServiceProvider(string fileName)
        {
            if (fileName == null || fileName.Length == 0)
            {
                throw new ArgumentNullException("fileName");
            }

            this.writer = new StreamWriter(fileName);
        }

        #region IJournalingServiceProvider Members

        public void Write(object message)
        {
            string msg = message as string;
            this.writer.WriteLine(msg);
        }

        #endregion

        #region IDisposable Members

        public void Dispose()
        {
            this.writer.Close();
        }

        #endregion

        #region IJournalingServiceProvider Members


        public void Write(object message, params object[] args)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
